<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>使用百分比来设置元素的最大宽度</title>
    <style>
        p {
            max-width: 20%;
            background-color: yellow;
        }
    </style>
</head>

<body>

    <p>This is some text. This is some text. This is some text.
        This is some text. This is some text. This is some text.
        This is some text. This is some text. This is some text.</p>

</body>

</html>